<%= form_for [:admin, @user], html: { class: "card" } do |f| %>
  <div class="card-body">
    <h3 class="card-title">
      <% if @user.new_record? %>
      添加用户
      <% else %>
      修改用户
      <% end %>
    </h3>
    <div class="row">
      <div class="col-md-4">
        <div class="form-group">
          <div class="form-label">用户状态</div>
          <div class="custom-controls-stacked">
            <label class="custom-control custom-radio custom-control-inline">
              <%= f.radio_button :state, "agree", { class: "custom-control-input" } %>
              <span class="custom-control-label">同意</span>
            </label>
            <label class="custom-control custom-radio custom-control-inline">
              <%= f.radio_button :state, "disagree", { class: "custom-control-input" } %>
              <span class="custom-control-label">拒绝</span>
            </label>
          </div>
        </div>
      </div>
    </div>
    <div class="row">
      <div class="col-md-4">
        <div class="form-group">
          <label class="form-label">账户余额</label>
          <%= f.number_field :moneybag, class: "form-control", step: "0.01" %>
        </div>
      </div>
      <div class="col-md-4">
        <div class="form-group">
          <label class="form-label">账户分红</label>
          <%= f.number_field :bonus, class: "form-control", step: "0.01" %>
        </div>
      </div>
      <div class="col-md-4">
        <div class="form-group">
          <label class="form-label">用户等级</label>
          <%= f.select :membership_id, Membership.where(published: true).select('id, name').map{ |c| [c.name, c.id] }, { include_blank: '请选择等级' }, { class: 'form-control select' } %>
        </div>
      </div>
    </div>
  </div>
  <div class="card-footer text-right">
    <button type="submit" class="btn btn-primary">保 存</button>
  </div>
<% end %>